package com.example.bishe.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.bishe.entity.Room;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.bishe.web.b.vo.getRoomPageVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author LDH
 * @since 2022/11/30
 */
@Mapper
public interface RoomMapper extends BaseMapper<Room> {

    IPage<getRoomPageVO> getPage(IPage<getRoomPageVO> page,
                                 @Param("name") String name,
                                 @Param("startTime") String startTime,
                                 @Param("endTime") String endTime,
                                 @Param("state") String state,
                                 @Param("type") String type,
                                 @Param("userName") String userName,
                                 @Param("userMIN") Integer userMIN,
                                 @Param("userMAX") Integer userMAX
                                 );

    @Select("SELECT * FROM room WHERE user_id=#{userId}")
    List<Room> getRoomNumByUser(Long userId);

    List<Room> getRoomByUser(@Param("userId") Long userId);

    IPage<Room> getCPage(
            IPage<Room> page,
            @Param("userId") Long userId,
            @Param("title") String title
    );
}
